#include "MyD3DMethod.h"



MyD3DMethod::MyD3DMethod()
{
}


MyD3DMethod::~MyD3DMethod()
{
}

ID3D10Buffer* MyD3DMethod::CreatBuffer(UINT ByteWidth, D3D10_USAGE Usage, UINT BindFlags, UINT CPUAccessFlags, UINT MiscFlags,ID3D10Device* device ,void *data)
{
	ID3D10Buffer* mbuffer=0;
	HRESULT hr = 0;
	D3D10_BUFFER_DESC vbd;
	vbd.Usage = Usage;
	vbd.ByteWidth = ByteWidth;
	vbd.BindFlags = BindFlags;
	vbd.CPUAccessFlags = CPUAccessFlags;
	vbd.MiscFlags = MiscFlags;
	D3D10_SUBRESOURCE_DATA vinitData;
	vinitData.pSysMem = data;
	if (data==0)
	{
		hr = device->CreateBuffer(&vbd, 0, &mbuffer);
	}
	else
	{
		hr = device->CreateBuffer(&vbd, &vinitData, &mbuffer);
	}
	
	if (hr==S_OK)
	{
		return mbuffer;
	}
	else
	{
		mbuffer = 0;
		return mbuffer;
	}
	
}
